Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

table

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table

Formats data into a string table.

  • 6.8.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-80.16%
Maintainers
2
Weekly downloads
 
Created

What is table?

The table npm package is a utility for generating text-based tables for Node.js applications. It provides a simple yet flexible way to create and manipulate tables in the console or other text-based outputs. It supports custom borders, padding, alignment, and more, making it a versatile tool for displaying tabular data in a structured format.

What are table's main functionalities?

Basic table creation

This feature allows you to create a simple table by providing an array of arrays. Each sub-array represents a row in the table. The first sub-array can be used for headers.

"use strict";\nconst {table} = require('table');\nlet data = [\n    ['Name', 'Age'],\n    ['Alice', 24],\n    ['Bob', 19]\n];\nconsole.log(table(data));

Custom border styles

This feature allows customization of the table's border by using predefined border styles or creating custom ones. It enhances the visual appearance of the table.

"use strict";\nconst {table, getBorderCharacters} = require('table');\nlet config = {\n    border: getBorderCharacters('ramac')\n};\nlet data = [\n    ['Name', 'Age'],\n    ['Alice', 24],\n    ['Bob', 19]\n];\nconsole.log(table(data, config));

Column width and alignment

This feature allows you to specify the width and alignment of columns, providing control over the layout and presentation of data within the table.

"use strict";\nconst {table} = require('table');\nlet config = {\n    columns: {\n        0: {\n            width: 10,\n            alignment: 'left'\n        },\n        1: {\n            width: 5,\n            alignment: 'right'\n        }\n    }\n};\nlet data = [\n    ['Name', 'Age'],\n    ['Alice', 24],\n    ['Bob', 19]\n];\nconsole.log(table(data, config));

Other packages similar to table

Keywords

FAQs

Package last updated on 26 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc